package com.Alan.service.role;

import com.Alan.dao.BaseDao;
import com.Alan.dao.role.RoleDao;
import com.Alan.dao.role.RoleDaoImpl;
import com.Alan.pojo.Role;
import org.junit.Test;

import java.sql.Connection;
import java.util.List;

public class RoleServiceImpl implements RoleService {

    //引入DAO
    private RoleDao roleDao = null;

    public RoleServiceImpl() {
        roleDao = new RoleDaoImpl();
    }

    @Override
    public List<Role> getRoleList(int userRoleNow) {
        Connection connection = BaseDao.getConnection();
        List<Role> roleList = roleDao.getRoleList(connection, userRoleNow);
        BaseDao.closeResource(connection, null, null);
        return roleList;
    }



    @Test
    public void text(){
        RoleService roleService = new RoleServiceImpl();
        /*List<Role> roleList = roleService.getRoleList();

        for (Role role:roleList) {
            System.out.println(role.getRoleName());
        }*/
    }
}
